package com.cmcc.groupcontacts.firewall.dao;

import com.cmcc.groupcontacts.firewall.dao.model.BaseModel;
import com.cmcc.groupcontacts.firewall.dao.model.CallListVO;

/**
 * 来电拦截记录DAO
 * 
 * @author 
 *
 */
public class CallListDAO extends BaseDAO<CallListVO> {
	public static String TABLE_NAME = "call_list";

	public CallListDAO() {
		super(TABLE_NAME);
	}

	@Override
	protected CallListVO getInstance() {
		return new CallListVO();
	}

	@Override
	protected String[] getBeanAllCols() {
		return CallListVO.MetaData.ALL_COLS;
	}

	@Override
	protected void afterGetColValue(BaseModel bean, String colName, String value) {
		CallListVO callList = (CallListVO) bean;
		if (CallListVO.MetaData.ID.equals(colName))
			callList.setId(Integer.valueOf(value));
		else if (CallListVO.MetaData.NUMBER.equals(colName))
			callList.setNumber(value);
		else if (CallListVO.MetaData.NAME.equals(colName))
			callList.setName(value);
		else if (CallListVO.MetaData.DATE.equals(colName))
			callList.setDate(Long.valueOf(value));
		else if (CallListVO.MetaData.DURATION.equals(colName))
			callList.setDuration(Integer.valueOf(value));
		else if (CallListVO.MetaData.TYPE.equals(colName))
			callList.setType(Integer.valueOf(value));
	}
}
